﻿using System;
using sinetd.Utilities;

namespace ping
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "ping [sinetd]";

            Console.WriteLine();
            Console.WriteLine("Ping Pong");

            sinetd.Config cfg = new sinetd.Config();

            cfg.SetDefault("protocol", "Tcp");
            cfg.SetDefault("port", "2201");

            cfg.SetDefault("host", "localhost");
            cfg.SetDefault("count", "100");

            ConsoleAddons.ParseArguments(args, cfg, new string[] { "host", "count" });

            Console.WriteLine(cfg.PrintDictionary());

            PingPong pp = new PingPong(cfg);

            string ans = pp.Ping(cfg.GetInt32("count"));

            Console.WriteLine(ans);

            //Console.ReadKey();
        }
    }
}
